<?php
/**
 * Created by PhpStorm.
 * User: lx
 * Date: 2019/12/26
 * Time: 13:36
 */

namespace app\api\controller;

use app\Validate\CityValidate;
use data\service;

/**
 * 获取地区
 *
 * Class City
 * @package app\api\controller
 * @dzl
 */
class City
{
    //获取区域
    public function getArea(){
        $area = new service\Address();
        //查询所有的地区信息
        $area_list = $area->getAreaList();
       return return_json_data($area_list);
    }

    //获取省份
    public function getProvince(CityValidate $cityValidate){
        $post = $cityValidate->request->post('id');
        $area = new service\Address();
        //查询所有的省信息
        $province_list = $area->getProvinceList($post);
        return return_json_data($province_list);

    }

    //获取城市
    public function getCity(CityValidate $cityValidate){
        $post = $cityValidate->request->post('id');
        $area = new service\Address();
        //查询所有的市信息
        $city_list = $area->getCityList($post);
        return return_json_data($city_list);
    }

    //获取地区
    public function getDistrict(CityValidate $cityValidate){
        $post = $cityValidate->request->post('id');
        $area = new service\Address();
        //查询所有的区县的信息
        $district_list = $area->getDistrictList($post);
        return return_json_data($district_list);
    }

}